package com.zsrt.day20170506.socket;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

/**
*@author jzh
*@创建时间 2017年5月6日下午4:12:44
*类说明：
*/
public class ServerSocketTest {
	
	public static void main(String[] args) throws IOException {
		ServerSocket ss=new ServerSocket(2222);
		System.out.println("server start ok");
		Socket s = ss.accept();
		InputStream is = s.getInputStream();
		byte[] b=new byte[1024];
		int len=0;
		while((len=is.read(b))!=-1){
			String str=new String(b, 0, len);
			System.out.println(str);
		}
	}

}
